/*******************************************************************************
 * Copyright (c) 2011 Olexandr V. Shaposhnikov.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Olexandr V. Shaposhnikov - initial API and implementation and/or initial documentation
 *******************************************************************************/
package com.funkyroach.use.perspectives;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.console.IConsoleConstants;

import com.funkyroach.use.ui.wizard.USNewProjectWizard;

public class USPerspective implements IPerspectiveFactory {

    private IPageLayout factory;

    public USPerspective() {
        super();
    }

    public void createInitialLayout(IPageLayout factory) {
        this.factory = factory;
        addViews();
        addActionSets();
        addNewWizardShortcuts();
        addPerspectiveShortcuts();
        addViewShortcuts();

    }

    
    private void addViews() {

        IFolderLayout bottom = factory.createFolder("bottomRight", // NON-NLS-1
                IPageLayout.BOTTOM, 0.75f, factory.getEditorArea());

        bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
        bottom.addView(IPageLayout.ID_TASK_LIST);
        bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);
        bottom.addView("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1

        IFolderLayout topLeft = factory.createFolder("topLeft", // NON-NLS-1
                IPageLayout.LEFT, 0.25f, factory.getEditorArea());
        topLeft.addView("org.eclipse.dltk.ui.ScriptExplorer");

        IFolderLayout right = factory.createFolder("right", // NON-NLS-1
                IPageLayout.RIGHT, 0.75f, factory.getEditorArea());
        right.addView(IPageLayout.ID_OUTLINE);

    }

    private void addActionSets() {
        factory.addActionSet("org.eclipse.debug.ui.launchActionSet"); // NON-NLS-1
        factory.addActionSet("org.eclipse.debug.ui.debugActionSet"); // NON-NLS-1
        factory.addActionSet("org.eclipse.debug.ui.profileActionSet"); // NON-NLS-1
        factory.addActionSet("org.eclipse.team.ui.actionSet"); // NON-NLS-1
        factory.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); // NON-NLS-1
    }

    private void addPerspectiveShortcuts() {
        factory.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); // NON-NLS-1
        factory.addPerspectiveShortcut("org.eclipse.team.cvs.ui.cvsPerspective"); // NON-NLS-1
        factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); // NON-NLS-1
    }

    private void addNewWizardShortcuts() {
        factory.addNewWizardShortcut("com.funkyroach.use.ui.wizards.new.project");// NON-NLS-1
        factory.addNewWizardShortcut("com.funkyroach.use.ui.wizards.new.package");// NON-NLS-1
        factory.addNewWizardShortcut("com.funkyroach.use.ui.wizards.new.class");// NON-NLS-1
    }

    private void addViewShortcuts() {
        factory.addShowViewShortcut("org.eclipse.pde.ui.DependenciesView"); // NON-NLS-1
        factory.addShowViewShortcut("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1
        factory.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
        factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
        factory.addShowViewShortcut(IPageLayout.ID_OUTLINE);
    }
}
